import 'package:flutter/material.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/publicBussine/bussine_font.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_card.dart';

class AccountTextfieldMonryItem extends StatelessWidget {
  final String title;
  final String? hintText;
  final String buttonText;
  final double monry;
  final FocusNode? focusNode;
  final TextEditingController controller;

  AccountTextfieldMonryItem({
    super.key,
    required this.title,
    this.hintText,
    required this.buttonText,
    required this.monry,
    required this.controller,
    this.focusNode,
  });

  @override
  Widget build(BuildContext context) {
    return MGCard(
      margin: EdgeInsets.all(16),
      padding: EdgeInsets.all(16),
      children: [
        Row(
          children: [Text(title, style: TextStyle(fontSize: MGFont.textFont1, color: MGColors.text1Color))],
        ),
        SizedBox(height: 5),
        Row(
          children: [
            Text("¥",
                style: TextStyle(
                  color: MGColors.text1Color,
                  fontWeight: FontWeight.bold,
                  fontSize: MGFont.titleFont1,
                )),
            SizedBox(width: 10),
            Expanded(
                child: TextField(
              controller: controller,
              focusNode: this.focusNode,
              keyboardType: TextInputType.number,
              style: TextStyle(fontSize: MGFont.titleFont4, color: MGColors.text1Color),
              decoration: InputDecoration(
                hintText: hintText,
                hintStyle: TextStyle(color: MGColors.text3Color, fontSize: MGFont.textFont2),
                enabledBorder: UnderlineInputBorder(borderSide: BorderSide.none),
                focusedBorder: UnderlineInputBorder(borderSide: BorderSide.none),
              ),
            )),
            InkWell(
              child: Container(
                padding: EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
                decoration: BoxDecoration(
                  border: Border.all(color: MGColors.splitColor, width: 1),
                  borderRadius: BorderRadius.circular(16),
                ),
                child: Text(buttonText,
                    style: TextStyle(
                      color: MGColors.text1Color,
                      fontSize: MGFont.textFont1,
                    )),
              ),
              onTap: () {
                controller.text = monry.toStringAsFixed(2);
              },
            )
          ],
          crossAxisAlignment: CrossAxisAlignment.center,
        )
      ],
    );
  }
}
